package com.alibaba.otter.node.etl.load.loader.mq.rabbit.strategy;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class ActionChain {

    private Class<? extends Exception> ex;

    private EndStrategyBuild endBuilder;

    public ActionChain(EndStrategyBuild endBuilder) {
        this.endBuilder = endBuilder;
    }

    public static ActionChain start() {
        return new ActionChain(new EndStrategyBuild());
    }

    public MqExceptionHandlerBuilder when(Class<? extends Exception> ex) {
        endBuilder.addExceptionClass(ex);
        return new MqExceptionHandlerBuilder(endBuilder);
    }
}
